import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BillTypeVO, BillTypeForm, BillTypeQuery } from '@/api/fms/billType/types';

/**
 * 查询财务主列表
 * @param query
 * @returns {*}
 */

export const listBillType = (query?: BillTypeQuery): AxiosPromise<BillTypeVO[]> => {
  return request({
    url: '/fms/billType/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询财务主详细
 * @param typeId
 */
export const getBillType = (typeId: string | number): AxiosPromise<BillTypeVO> => {
  return request({
    url: '/fms/billType/' + typeId,
    method: 'get'
  });
};

/**
 * 新增财务主
 * @param data
 */
export const addBillType = (data: BillTypeForm) => {
  return request({
    url: '/fms/billType',
    method: 'post',
    data: data
  });
};

/**
 * 修改财务主
 * @param data
 */
export const updateBillType = (data: BillTypeForm) => {
  return request({
    url: '/fms/billType',
    method: 'put',
    data: data
  });
};

/**
 * 删除财务主
 * @param typeId
 */
export const delBillType = (typeId: string | number | Array<string | number>) => {
  return request({
    url: '/fms/billType/' + typeId,
    method: 'delete'
  });
};
